package com.neusoft.liduan.d0914;

public class Dog {
	//4，设计一个Dog类，有名字、颜色、年龄等属性，定义构造方法来初始化类的这些属性，定义方法输出Dog信息，编写应用程序使用Dog类
	private String name;
	private String color;
	private int age;
	
	public Dog(String name, String color, int age) {
		super();
		this.name = name;
		this.color = color;
		setAge(age);
	}

	@Override
	public String toString() {
		return "Dog [name=" + name + ", color=" + color + ", age=" + age + "]";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		if(age > 20) {
			return;
		}
		this.age = age;
	}
	
}
